import db from "@/db";
import { NextResponse } from "next/server";

export async function GET(request: Request, { params }: { params: Promise<{ id: string }> }) {
    const { id } = await params

    const data = db.data.users.find(user => user.id === Number(id))
    if (!data) {
        return NextResponse.json({
            code: 1,
            msg: '用户不存在!'
        })
    }
    return NextResponse.json({
        code: 0,
        data,
        msg: '查询成功'
    })
}